package com.example.androidframework.ui.course.flow

import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.lifecycle.lifecycleScope
import com.example.androidframework.R
import com.example.androidframework.databinding.ActivityFlowBinding
import com.martin.lib_base.base.BaseActivity
import com.martin.lib_base.interfaces.IOnItemClickListener
import com.martin.lib_base.ktx.addOnItemClickListener
import com.martin.lib_base.ktx.refresh
import com.xuexiang.xui.utils.StatusBarUtils
import kotlinx.coroutines.launch

class FlowActivity : BaseActivity<ActivityFlowBinding,FlowViewModel>() {

    override fun getViewModelClass() = FlowViewModel::class.java

    override fun layoutId() = R.layout.activity_flow
    
    override fun initOnCreate(savedInstanceState: Bundle?) {
        binding.viewModel = viewModel
        binding.rv.refresh(viewModel.items)

        binding.rv.addOnItemClickListener(object : IOnItemClickListener {
            override fun onItemClick(position: Int, type: Int) {
                viewModel.onItemClick(position)
            }
        })



        lifecycleScope.launch {
            coroutineTest()
        }
    }

    suspend fun coroutineTest() {

    }

    companion object {
        @JvmStatic
        fun start(context: Context) {
            context.startActivity(Intent(context, FlowActivity::class.java))
        }
    }
}